package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.ResouBean;
import com.lwj.liwanjia.impl.ResouView;
import com.lwj.liwanjia.model.ResouModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/27.
 */

public class ResouPresenter {
    private ResouView resouView;
    private ResouModel resouModel;

    public ResouPresenter(ResouView resouView) {
        this.resouView = resouView;
        resouModel = new ResouModel();
    }

    public void getResouData(String token, String type) {
        if (resouView != null) {
            resouModel.getResouData(token, type, new Subscriber<ResouBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    resouView.showError((Exception) e);
                }

                @Override
                public void onNext(ResouBean resouBean) {
                    resouView.getResouData(resouBean);
                }
            });
        }
    }
}
